package com.goddess.yeecolor.view;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;

import com.goddess.yeecolor.R;
import com.goddess.yeecolor.activity.MyAppClient;

/**
 * 活动详情  具体电话  位置文本设置
 */
public class Item_Exerciseitem {

    public static TextView initTile(View view,String title){
        TextView textTitle=(TextView)view.findViewById(R.id.item_exerciseitem_title);
        textTitle.setVisibility(View.VISIBLE);
        textTitle.setText(title);
        return textTitle;
    }

    public static TextView initTime(View view,String title,int id, View.OnClickListener listener){

        TextView textTitle=(TextView)view.findViewById(R.id.item_exerciseitem_time);
        setDrable(view,textTitle,id,title);
        textTitle.setOnClickListener(listener);
        return textTitle;
    }

    public static TextView initPlace(View view,String title,int id, View.OnClickListener listener){

        TextView textTitle=(TextView)view.findViewById(R.id.item_exerciseitem_place);
        setDrable(view,textTitle,id,title);
        textTitle.setOnClickListener(listener);
        return textTitle;
    }
    public static TextView initPeople(View view,String title,int id, View.OnClickListener listener){

        TextView textTitle=(TextView)view.findViewById(R.id.item_exerciseitem_people);
        setDrable(view,textTitle,id,title);
        textTitle.setOnClickListener(listener);
        return textTitle;
    }
    public static TextView initPices(View view,String title,int id, View.OnClickListener listener){

        TextView textTitle=(TextView)view.findViewById(R.id.item_exerciseitem_picese);
        setDrable(view,textTitle,id,title);
        textTitle.setOnClickListener(listener);
        return textTitle;
    }
    public static TextView initPhone(View view,String title,int id, View.OnClickListener listener){

        TextView textTitle=(TextView)view.findViewById(R.id.item_exerciseitem_phone);
        setDrable(view,textTitle,id,title);
        textTitle.setOnClickListener(listener);
        return textTitle;
    }


    private static void setDrable(View view,TextView textView,int icon,String title){

        textView.setVisibility(View.VISIBLE);
        textView.setText(title);
        Drawable drawable= MyAppClient.getInstance().getResources().getDrawable(icon);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
        textView.setCompoundDrawables(drawable,null,null,null);//设置TextView的drawableleft
    }
}
